package com.gitee.wsl.store.db

import androidx.room.Room
import androidx.room.RoomDatabase
//import com.gitee.wsl.store.db.DB_NAME
//import com.gitee.wsl.store.db.KVStoreDatabase
/*import kotlinx.cinterop.ExperimentalForeignApi
import platform.Foundation.NSDocumentDirectory
import platform.Foundation.NSFileManager
import platform.Foundation.NSURL
import platform.Foundation.NSUserDomainMask

@OptIn(ExperimentalForeignApi::class)
fun createAppDatabase(): RoomDatabase.Builder<KVStoreDatabase> {
    val documentDirectory: NSURL? = NSFileManager.defaultManager.URLForDirectory(
        directory = NSDocumentDirectory,
        inDomain = NSUserDomainMask,
        appropriateForURL = null,
        create = false,
        error = null,
    )

    val dbFilePath = requireNotNull(documentDirectory).path + "/$DB_NAME"

    return Room.databaseBuilder<KVStoreDatabase>(
        name = dbFilePath,
        factory = { KVStoreDatabase::class.instantiateImpl() },
    )
}*/
